import pygame
from card_library import Card, CardLibrary

# 初始化 Pygame
print("初始化 Pygame")
pygame.init()

# 设置窗口大小
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption('二战题材卡牌游戏')

# 定义颜色
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)

# 创建字体对象
font = pygame.font.Font(None, 36)

# 示例卡牌库
library = CardLibrary()
card1 = Card('虎式坦克', '重型坦克', 80, '二战中德国的重型坦克，火力强大。')
library.add_card(card1)

# 游戏主循环
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    # 填充背景色
    screen.fill(WHITE)

    # 显示卡牌信息
    y_position = 50
    for card in library.get_all_cards():
        text = font.render(str(card), True, BLACK)
        screen.blit(text, (50, y_position))
        y_position += 50

    # 更新显示
    pygame.display.flip()

# 退出 Pygame
print("游戏正常退出")
pygame.quit()